<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>利用类选择器画三个盒子</title>
    <style>
      /* .box {
            width: 150px;
            height: 100px;
            font-size: 30px;
        } */
      .red {
        /* 背景颜色 */
        background-color: red;
      }
      .green {
        background-color: green;
        width: 100px; /* 当多个类选择器的属性值存在冲突时，按照类选择器的顺序进行覆盖，后面的会覆盖前面的 */
        height: 100px;
      }
      .box {
        width: 150px;
        height: 100px;
        font-size: 30px;
      }
    </style>
  </head>
  <body>
    <div class="box red">红色</div>
    <!-- 这里class的属性值顺序不影响 -->
    <!-- <div class="box green">绿色</div> -->
    <div class="green box">绿色</div>
    <div class="box red">红色</div>
  </body>
</html>
